﻿#include <iostream>

#include "core/bootapplication.h"
#include "core/confstarter.h"
#include "core/hookstarter.h"
#include "core/loggerstarter.h"
#include "core/starterregister.h"
#include "core/webstarter.h"

// TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
int main() {
    // 创建并注册不同的Starter实例
    ConfStarter confStarter;
    LoggerStarter loggerStarter;
    WebStarter webStarter;
    webStarter.SetBlocking(true);

    spdlog::set_level(spdlog::level::debug); // Set global log level to debug
    // 创建StarterContext实例
    auto starterContext = new StarterContext();
    auto starter_register = StarterRegister::getInstance();
    // 创建BootApplication实例
    BootApplication* boot = new BootApplication(false, *starterContext, starter_register);
    // 创建HookStarter实例
    HookStarter hookStarter(starter_register);

    starter_register->Register(&confStarter);
    starter_register->Register(&loggerStarter);
    starter_register->Register(&webStarter);

    starter_register->Register(&hookStarter);

    boot->Start();

    return 0;

}

// TIP See CLion help at <a
// href="https://www.jetbrains.com/help/clion/">jetbrains.com/help/clion/</a>.
//  Also, you can try interactive lessons for CLion by selecting
//  'Help | Learn IDE Features' from the main menu.